/**
 * @file test_long_connection.cc
 * @author 1102403684@qq.com
 * @brief 测试长连接是否正常
 * @version 0.1
 * @date 2024-11-02
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#include "../common/Socket.hpp"
#include "../common/LoggerHelper.hpp"
#include <unistd.h>
LoggerHelper helper;
int main()
{
    Socket client_socket;
    client_socket.create_client_socket("127.0.0.1", 8080);
    std::string req = "GET /hello HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n";
    while(1){
        assert(client_socket.send(req.c_str(), req.size()) != -1);
        char buffer[1024] = {0};
        client_socket.recv(buffer, 1023);
        LOG_DEBUG("{}", buffer);
        // sleep(3);
    }
    client_socket.close();

    return 0;
}